function legal() {
    //密码由英文字母和数字组成的4-10位字符
    var patt = /^[a-zA-Z0-9]{4,10}$/;
    let tip = document.getElementById("mytip");
    let old_password = [[${stu.getPassword()}]];
    let current_password = document.getElementById("current_password").value;
    let new_password = document.getElementById("new_password").value;
    let new_password1 = document.getElementById("new_password1").value;
    if (current_password == '') {
        tip.innerHTML = "当前密码不能为空";
        return false;
    } else if (old_password != current_password) {
        tip.innerHTML = "当前密码输入错误";
        return false;
    } else if (new_password == '') {
        tip.innerHTML = "新密码不能为空";
        return false;
    } else if (!patt.test(new_password)) {
        tip.innerHTML = "新密码输入不合法"
        return false;
    } else if (old_password == new_password) {
        tip.innerHTML = "新密码不能与旧密码相同";
        return false;
    } else if (new_password != new_password1) {
        tip.innerHTML = "确认密码与新密码不相同";
        return false;
    } else {
        alert("修改成功");
        return true;
    }
}
